import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
//导入全局样式表
import './assets/css/global.css'

import TreeTable from 'vue-table-with-tree-grid'

import ElementUI from 'element-ui';

Vue.use(ElementUI, {
  size: 'small',
  menuType: 'text'
})

Vue.config.productionTip = false

Vue.component('tree-table',TreeTable)

//页面跳转  直接到最上方   页面自动刷新
router.afterEach((to, from, next) => {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;
});

import axios from 'axios'
axios.defaults.baseURL = 'http://121.37.144.250:1010'
axios.interceptors.request.use(config => {
  // console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
Vue.prototype.$http = axios

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
